#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 1; i <= N * M; i++)
	{
		if (i % M == 0)
		{
			cout << "PUM" << endl;
		}
		else
		{
			cout << i << ' ';
		}
	}
	return 0;
}